﻿namespace Morin.Shared.Models;

public class TvSourceModel : IEquatable<TvSourceModel?>
{
    public required string GroupTitle { get; init; }
    public int Sort { get; set; }
    public IEnumerable<TvSourceDetailModel>? TvSourceDetails { get; set; }

    public override bool Equals(object? obj)
    {
        return Equals(obj as TvSourceModel);
    }

    public bool Equals(TvSourceModel? other)
    {
        return other is not null && GroupTitle == other.GroupTitle;
    }

    public override int GetHashCode()
    {
        return HashCode.Combine(GroupTitle);
    }

    public static bool operator ==(TvSourceModel? left, TvSourceModel? right)
    {
        return EqualityComparer<TvSourceModel>.Default.Equals(left, right);
    }

    public static bool operator !=(TvSourceModel? left, TvSourceModel? right)
    {
        return !(left == right);
    }
}

public class TvSourceDetailModel
{
    public int Id { get; set; }
    public string? Title { get; set; }
    public NetworkCarrierType NetworkCarrierType { get; set; }
    public string? WebAddr { get; set; }
}